package com.xquant.pricing.pricingConfig.entity;

import org.apache.ibatis.type.Alias;

import java.util.HashMap;
import java.util.Map;

/**
 * @Auther: B946
 * @Date: 25/12/2019 13:45
 * @Description:
 */
@Alias("Instrument1")
public class Instrument {

    private static Map<String, Object> mTypeMap = null;

    static {
        mTypeMap = new HashMap<String, Object>();
        mTypeMap.put("OTHER", "境外市场");
        mTypeMap.put("XDCE", "大商所");
        mTypeMap.put("XHKG", "港交所");
        mTypeMap.put("X_CBEEX", "环交所");
        mTypeMap.put("NONE", "基金市场");
        mTypeMap.put("SGEX", "金交所");
        mTypeMap.put("XSHG", "上交所");
        mTypeMap.put("XSGE", "上期所");
        mTypeMap.put("XSCH", "上清所");
        mTypeMap.put("XSHE", "深交所");
        mTypeMap.put("XSEX", "新交所");
        mTypeMap.put("X_CNBD", "银行间");
        mTypeMap.put("XZCE", "郑商所");
        mTypeMap.put("X_CNFFEX", "中金所");
        mTypeMap.put("X_CUAEX", "重交所");
        mTypeMap.put("XINE", "上期能源");
        mTypeMap.put("X_NEEQ", "新三板");
        mTypeMap.put("OTC_MARKET", "场外市场");
    }


    private String iCode;

    private String aType;

    private String mType;

    private String iName;

    public String getiCode() {
        return iCode;
    }

    public void setiCode(String iCode) {
        this.iCode = iCode;
    }

    public String getaType() {
        return aType;
    }

    public void setaType(String aType) {
        this.aType = aType;
    }

    public String getmType() {
        return mType;
    }

    public void setmType(String mType) {
        this.mType = mType;
    }

    public String getiName() {
        return iName;
    }

    public void setiName(String iName) {
        this.iName = iName;
    }


    /**
     * 返回i_name、i_code的拼装字符串(覆盖重写父类的)
     *
     * @return i_code  i_name
     */
    public String getDictKey() {
        if (org.apache.commons.lang3.StringUtils.isBlank(getiName())) {
            return getiCode();
        }
        /*return getiCode()  + "  "  + getiName() + "  " + mTypeMap.get(this.mType);*/
        return getiName();
    }

    /**
     * 返回i_name、i_code的拼装字符串(覆盖重写父类的)
     *
     * @return i_code  i_name
     */
    public String getDictValue() {
        return getiCode() + "," + getaType() + "," + getmType();
    }
}
